package com.business.dynamic.service.impl;


import java.util.List;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.plugins.Page;
import com.business.common.utils.PageUtils;
import com.business.common.dto.R;

import com.business.dynamic.entity.DynamicType;
import com.business.dynamic.mapper.DynamicTypeMapper;
import com.business.dynamic.service.DynamicTypeService;


/**
 * :业务接口实现类
 *
 * @author chenjiehong
 * @date 2020-03-08 23:38:51
 * @since 1.0
 */
@Service
@Transactional
public class DynamicTypeServiceImpl implements DynamicTypeService {

    @Autowired
    private DynamicTypeMapper dynamicTypeMapper;


    @Override
    public List<DynamicType> queryList(int state) {
        EntityWrapper entityWrapper = new EntityWrapper();
        if (state == 1) {
            entityWrapper.ne("state", 0);
        } else {
            entityWrapper.setSqlSelect("id,name");
            entityWrapper.eq("state", 1);
        }
        entityWrapper.orderBy("sort");
        return dynamicTypeMapper.selectList(entityWrapper);
    }
}